<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- <script src="../js/myQuery.js"></script> -->
  <script src="../js/jquery-1.10.1.min.js"></script>
  <style>
    * {
      padding: 0;
      margin: 0;
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    li {
      list-style: none;

    }

    .w {
      width: 1226px;
      margin: 0 auto;
    }

    .navBar {
      display: flex;
    }

    .navBar>li {
      text-align: center;
      line-height: 45px;
      flex: 1;
      border: 1px solid #333;
      position: relative;
    }

    .navBar>li+li {
      border-left: 0;
    }

    .navBar .subNav {
      position: absolute;
      top: 45px;
      left: 0;
      width: 300px;
      background-color: #6ff;
      display: none;
    }

    .navBar .active {
      background-color: pink;
      color: antiquewhite;
    }
  </style>
</head>

<body>
  <!-- .wrapNav>ul.navBar>li*6>a{link_$$}+ul.subNav>li*4{sub_$$} -->
  <div class="wrapNav w">
    <ul class="navBar">
      <li>
        <a href="javascript:;">link_01</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
      <li>
        <a href="javascript:;">link_02</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
      <li>
        <a href="javascript:;">link_03</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
      <li>
        <a href="javascript:;">link_04</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
      <li>
        <a href="javascript:;">link_05</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
      <li>
        <a href="javascript:;">link_06</a>
        <ul class="subNav">
          <li>sub_01</li>
          <li>sub_02</li>
          <li>sub_03</li>
          <li>sub_04</li>
        </ul>
      </li>
    </ul>
  </div>
</body>
<script>

  $(function () {
    $(".navBar>li").click(function () {
      // $(this).addClass("active").siblings().removeClass("active");
      // // this -> subNav
      // $(this).find(".subNav").show()
      // $(this).siblings().find(".subNav").hide()


      // $(this).addClass("active").siblings().removeClass("active");
      // // this -> subNav -> this  -> siblings ->  subNav
      // $(this).find(".subNav").show().end().siblings().find(".subNav").hide();

      // this -> subNav  -> this -> siblings ->  subNav
      $(this).addClass("active").find(".subNav").show().end().siblings().removeClass("active").find(".subNav").hide();

    })
  })





</script>

</html>